
#include<iostream>
#include "DoubleList.h"
using namespace std;



void PrintList(const List<int> &L)
{
	List<int>::const_iterator it;
 	for(it = L.begin();it!= L.end();it++ )
 	{
	  cout << *it <<" ";
	}
 	cout << endl;
 }

List<int>::iterator find(List<int> &L,  int val)
 {
 	bool flag = false;
	List<int>::iterator iter;
 
 	for(iter = L.begin();iter!= L.end();iter++ )
 	{
 	  if (*iter == val )
 	    {
 	      flag = true;
 	      break;
 	    }
 	}
	
	if(! flag )    iter = L.end();
	return iter;
}


 int main()
  {
     List<int> L;
     L.push_back(0);
     L.push_back(1);
     L.push_back(2);
     L.push_back(3);
     L.push_back(4);
     L.push_back(5);

     PrintList(L);
    
     List<int>::iterator iter = L.begin();
    
     iter =  find(L, 2);
     L.erase(iter);
     PrintList(L);

     
     iter = find(L,2);		
     L.erase(iter,2);
     PrintList(L);
    
    return 0;
}
